Toolformer: returned focussed charts in basic block #4488
+1,846
−99
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR retries the change that was undone in #4361.
Back-story:
In the "basic" block, typically we return multiple charts (timeline+highlight / map / ranking), with the first chart being the most relevant one for the query (ranking if "highest" was asked, etc). Since toolformer mode relies on the top-most chart, I thought the change to return just the specific chart was merely an optimization.
Turns out that this choice has accuracy impact too -- for instance, in [coal powered electricity generation in US states] (screenshot), if the top matching SV does not have state-level data, but the 2nd SV (a good match too) has state-level data, perhaps we want to use the 2nd one?
Fundamentally, there's a question on whether we should prefer showing a chart more accurate in place for a lower ranked SV, or a chart for a higher ranked SV that is less accurate in place.
Why the change above failed:
_populate_specific
we were not checking whether the user did ask for a child-place-type. For instance, [commute time in california] would implicitly have a "County" sub-type, and the top-chart should be for california, but ends up being a map of counties. Fix that problem by checking that the place-type is not the default one.dc/topic/ProjectedClimateExtremes
, which was a special case with multiple variables per ranking chart. This PR requires that topic to specify a child-type in the query (and accordingly updates the demo query).Finally, rename
simple
fulfiller toplace_vars
(slightly more meaningful).